<div class="main-title">
  <h2>文章管理</h2>
</div>
<div class="main-section form-inline">
  <a href="/admin/article/edit" class="btn btn-success">+ 新增</a>
</div>
<div class="main-section">
  <table class="table table-striped table-bordered table-hover">
    <thead>
      <tr>
        <th>标题</th>
        <th>作者</th>
        <th>已发布</th>
        <th>阅读量</th>
        <th>创建时间</th>
        <th>操作</th>
      </tr>
    </thead>
    <tbody>
      {if $article}
      {foreach $article as $v}
      <tr>
        <td>
          <a href="/admin/article/edit?id={$v.id}">{$v.title}</a>
        </td>
        <td>{$v.author}</td>
        <td>{if $v.show}是{else}否{/if}</td>
        <td>{$v.views}</td>
        <td>{$v.created_at}</td>
        <td>
          <a href="/admin/article/edit?id={$v.id}" style="margin-right:5px;">编辑</a>
          <a href="/admin/article/delete?id={$v.id}" class="j-del text-danger">删除</a>
        </td>
      </tr>
      {/foreach}
      {else}
      <tr>
        <td colspan="6" class="text-center">列表为空</td>
      </tr>
      {/if}
    </tbody>
  </table>
  <div class="text-center">{$page_html nofilter}</div>
</div>
<script>
  main.menuActive('article');
  $('.j-del').click(function() {
    if (confirm('您确定要删除此项？')) {
      main.ajaxPost($(this).attr('href'), function() {
        main.contentRefresh();
      });
    }
    return false;
  });
</script>